<template>
    <Card>
        <Row>
            备注列表
        </Row>
        <Card>
            <Table border :columns="approvalOpinionCols" :data="approvalOpinionDatas"></Table>
        </Card>
    </Card>
</template>

<script>
export default {
  name: 'loan-approval-form',
  data () {
    return {
      loanId: '',
      fundName: null,
      approvalOpinionCols: [
        {
          type: 'index'
        },
        {
          title: '流程阶段',
          key: 'nodeName'
        },
        {
          title: '处理结果',
          key: 'caseResult'
        },
        {
          title: '处理意见',
          key: 'opinion'
        },
        {
          title: '处理人',
          key: 'createdBy'
        },
        {
          title: '处理时间',
          key: 'updatedDate',
          render: (h, params) => {
            var vm = this
            return h('span', {}, vm.$util.formatTime(params.row.updatedDate))
          }
        }
      ],
      approvalOpinionDatas: []
      // 审批确认 ， 审批结果
    }
  },
  methods: {
    // 初始化
    initData () {
      var params = {}
      params.loanId = this.$route.query.loanId// var url = this.baseUrl+'approve/video/service/queryLoanApplyCaseLogs/'+this.$route.query.loanId;
      this.$ajax.get(this.$appContext.marvels_core_approve + 'approve/video/service/queryLoanApplyCaseLogs/' + this.$route.query.loanId).then(re => {
        var data = re.data
        var message = data.message
        if (re.data.code === 'success') {
          // this.$Message.success({ title: '提示', content: message, onOk () { } })
          // 初始化
          // this.initApprovalLogDatas(re.data.data.opinions);
          this.approvalOpinionDatas = re.data.data
        } else {
          this.$Message.warning({ title: '提示', content: message, onOk () { } })
        }
      }).catch(er => {

      })
    }
  },
  computed: {

  },
  mounted () {

  },
  created () {
    this.loanId = this.taskParams.curLoanId
    this.$ajax = this.$util.ajax()
    this.initData()
  },
  watch: {
    // 点击tab页签，加载数据，只加载一次
    'taskParams.approvalResult' (v) {
      if (v) {
        this.loanId = this.taskParams.curLoanId
        this.initData()
      }
    }
  },

  props: {
    taskParams: Object
  }
}
</script>
